package smetana.modules.ui.context;

/**
 * @author dmitry.mamonov
 */
public class EventContext {
    static Type currentContextType = Type.User;

    public Type getCurrentContextType() {
        return currentContextType;
    }

    public static void runInContext(Runnable runnable) {
        Type lastContextType = currentContextType;
        try {
            runnable.run();
        } finally {
            currentContextType = lastContextType;
        }

    }

    public enum Type {
        User, Code
    }
}
